# Maintainer: Michał Polański <michal@polanski.me>
pkgname=py3-mitmproxy-rs
pkgver=0.9.3
pkgrel=0
pkgdesc="mitmproxy modules written in Rust"
url="https://github.com/mitmproxy/mitmproxy_rs"
license="MIT"
arch="all"
makedepends="
	cargo
	py3-gpep517
	py3-installer
	py3-maturin
	py3-setuptools
	py3-wheel
	"
subpackages="$pkgname-pyc"
source="https://github.com/mitmproxy/mitmproxy_rs/archive/v$pkgver/py3-mitmproxy-rs-$pkgver.tar.gz"
builddir="$srcdir/mitmproxy_rs-$pkgver"
options="net" # cargo

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cd mitmproxy-rs
	gpep517 build-wheel \
		--wheel-dir "$builddir"/.dist \
		--output-fd 3 3>&1 >&2
}

check() {
	cargo test --frozen
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
7205ec974aed1a0f4ace3d941e860eb3f80ccd3b21550c9d375d709a20b48747d2ccaf05682b41eebb6ab2418b1334f631c8e67e060bb5bedb49563d45b9963b  py3-mitmproxy-rs-0.9.3.tar.gz
"
